/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quizzempire.view;

import java.io.File;
import javax.swing.JFrame;
import quizzempire.model.IModel;
import quizzempire.model.Model;
import quizzempire.model.statemachine.State;

/**
 *
 * @author Paulo Duarte | isec.pt | 21220336 | pauloporteladuarte@gmail.com
 */
public class MainBuilder {
    
    public static void main(String args[])
    {
        startMenu();
    }
    
    static private void startMenu()
    {
        File f = new File("resources");
        String folder = f.getAbsolutePath() +"\\";
        if(!f.exists())
            f.mkdir();
        IModel model = new Model(folder);
        
        new MainMenu(model).setVisible(true);
    }

    static void changeScreen(JFrame actual, IModel model, State state) {
        
        if (state instanceof quizzempire.model.statemachine.AwaitsInstruction)
        {
            actual.setVisible(false);
            actual.dispose();
            new MainMenu(model).setVisible(true);
        }
        
        if (state instanceof quizzempire.model.statemachine.QuizzConfiguration)
        {
            actual.setVisible(false);
            actual.dispose();
            new QuizzConfiguration(model).setVisible(true);
        }
        
        if (state instanceof quizzempire.model.statemachine.QuestionEditor)
        {
            actual.setVisible(false);
            actual.dispose();
            new QuestionEditor(model).setVisible(true);
        }
        if (state instanceof quizzempire.model.statemachine.PrepareGame)
        {
            actual.setVisible(false);
            actual.dispose();
            new StartGame(model).setVisible(true);
        }
        
        if (state instanceof quizzempire.model.statemachine.AwaitsAnswer)
        {
            actual.setVisible(false);
            actual.dispose();
            new GameInterface(model).setVisible(true);
        }
        if (state instanceof quizzempire.model.statemachine.ShowResults)
        {
            actual.setVisible(false);
            actual.dispose();
            new EndGame(model).setVisible(true);
        }
        
        if (state instanceof quizzempire.model.statemachine.SelectQuizzEdit)
        {
            actual.setVisible(false);
            actual.dispose();
            new EditQuizz(model).setVisible(true); 
        }
        
    }
    
    
    
}
